package pers.jphoebe.quartz.utils;


import pers.jphoebe.quartz.entity.response.ErrorCode;
import pers.jphoebe.quartz.entity.response.ResponseData;

/**
 * Created by 蒋时华 on 2017-8-1.
 */
public class ResponseDataUtils  {

    public static ResponseData success(){
        ResponseData responseData = new ResponseData();
        responseData.setCodeAndMessage(ErrorCode.SUCCESS_CODE);
        return responseData;
    }

    public static ResponseData success(Object data){
        ResponseData responseData = new ResponseData();
        responseData.setCodeAndMessage(ErrorCode.SUCCESS_CODE);
        responseData.setData(data);
        return responseData;
    }

    public static ResponseData error(Integer code,String msg){
        ResponseData responseData = new ResponseData();
        responseData.setCode(code);
        responseData.setMessage(msg);
        return responseData;
    }
    public static ResponseData error(Integer code,String msg,Object data){
        ResponseData responseData = new ResponseData();
        responseData.setCode(code);
        responseData.setData(data);
        responseData.setMessage(msg);
        return responseData;
    }

    public static ResponseData error(ErrorCode errorCode){
        ResponseData responseData = new ResponseData();
        responseData.setCodeAndMessage(errorCode);
        return responseData;
    }

    public static ResponseData error(ErrorCode errorCode,Object data){
        ResponseData responseData = new ResponseData();
        responseData.setCodeAndMessage(errorCode);
        responseData.setData(data);
        return responseData;
    }

}
